package zzz.tuan2d.toidihoilo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class BaseActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	public void initHeader(String title) {
		findViewById(R.id.buttonBack).setOnClickListener(onBackClick);
		findViewById(R.id.imageViewNewReport).setOnClickListener(
				onNewReportClick);
		((TextView) findViewById(R.id.textViewTitle)).setText(title);
	}

	public void disableCreateButton(boolean isEnable) {
		findViewById(R.id.imageViewNewReport).setVisibility(
				isEnable ? View.VISIBLE : View.GONE);
	}

	OnClickListener onBackClick = new OnClickListener() {

		@Override
		public void onClick(View v) {
			finish();
		}
	};

	OnClickListener onNewReportClick = new OnClickListener() {

		@Override
		public void onClick(View v) {
			startActivity(new Intent(BaseActivity.this,
					ReportCreateActivity.class));
		}
	};
}
